//
//  ST_Custom255AttachmentModel.swift
//  btvideo
//
//  Created by mac on 2020/10/15.
//  Copyright © 2020 JarvanZhang. All rights reserved.
//

import UIKit
import SwiftyJSON

class ST_Custom255AttachmentModel: ST_BTMessageAttachDecoder {
    
    /**
       0 :充币红包
       1 :领取充币红包
       2 :喜欢道具
       3 :新守护 有收益
       4 :新礼物 有收益
       5 :搭讪礼物
        */
   var type: Int = 0
   var redPacketId:String = ""
   var redPacketCoinNum:Int = 0
   var redPacketIncome:Float = 0
   var redPacketTxt: String = ""
   var goodsId: String = ""
   var title: String = ""
   var subTitle: String = ""
   var imageUrl: String = ""
   var svgaUrl:String?

    override func encode() -> String {
        
        var dict = ["type":self.type,"redPacketId":self.redPacketId,"redPacketCoinNum":self.redPacketCoinNum,"redPacketIncome":self.redPacketIncome,"redPacketTxt":self.redPacketTxt,"goodsId":self.goodsId,"title":self.title,"subTitle":self.subTitle,"imageUrl":self.imageUrl,"msgType":255] as [String : Any]
        
        if let url = svgaUrl,url.count > 2 {
            dict.updateValue(url, forKey: "svgaUrl")
        }
        
        let json = JSON(dict)
        
        let res = json.rawString() ?? ""
        
        return res
    }
}




class ST_Custom2649AttachmentModel: ST_BTMessageAttachDecoder {
    
    /**
       0 :wechat
        */
   var type: Int = 0
   var wechatText:String = ""
   
    override func encode() -> String {
        
        let dict = ["type":self.type,"wechatText":wechatText,"msgType":2649] as [String : Any]
        
        let json = JSON(dict)
        
        let res = json.rawString() ?? ""
        
        return res
    }
}





class ST_Custom264AttachmentModel: ST_BTMessageAttachDecoder {
    
  
   var text:String = ""
   
    override func encode() -> String {
        
        let dict = ["text":"","msgType":264] as [String : Any]
        
        let json = JSON(dict)
        
        let res = json.rawString() ?? ""
        
        return res
    }
}
